
//
//  XYCallDetailFrame.m
//  Zhihuijinfu
//
//  Created by XY Lv on 17/3/26.
//  Copyright © 2017年 王笛. All rights reserved.
//

#import "XYCallDetailFrame.h"
#import "XYCommon.h"
#import "XYCallDetailItem.h"
@implementation XYCallDetailFrame

- (void)setCommentItem:(XYCallDetailCommentItem *)commentItem{
    _commentItem = commentItem;
    [self xySetSubviewsFrameWithItem:commentItem];
}

- (void)xySetSubviewsFrameWithItem:(XYCallDetailCommentItem *)callItem{
    CGFloat headImgViewX = xyPadding;
    CGFloat headImgViewY = xyPadding;
    CGFloat headImgViewW = xyHeadImgViewH;
    CGFloat headImgViewH = headImgViewW;
    self.headImgViewF = CGRectMake(headImgViewX, headImgViewY, headImgViewW, headImgViewH);
    
    CGFloat userNameLabelX = xyPadding + CGRectGetMaxX(self.headImgViewF);
    CGFloat userNameLabelY = headImgViewY;
    CGFloat userNameLabelH = headImgViewH/2;
    CGSize  userNameLabelSize =[XYCommon xy_getSizeWithStr:callItem.create_name font:xyUserNameTextFont maxSize:CGSizeMake(xyUserNameLableW, userNameLabelH)];
                                
                                
    CGFloat userNameLabelW = userNameLabelSize.width;
    self.userNameLabelF = CGRectMake(userNameLabelX, userNameLabelY, userNameLabelW, userNameLabelH);
    
   
    
    CGFloat publishTimeLabelW = xyPublisTimeLabelW;
    CGFloat publishTimeLabelH = userNameLabelH;
    CGFloat publishTimeLabelX = WDScreenW - publishTimeLabelW - xyPadding;
    CGFloat publishTimeLabelY = self.userNameLabelF.origin.y;
    
    self.publishTimeLabelF = CGRectMake(publishTimeLabelX, publishTimeLabelY, publishTimeLabelW, publishTimeLabelH);
    
    CGFloat commentContentX = self.userNameLabelF.origin.x;
    CGFloat commentContentY = CGRectGetMaxY(self.userNameLabelF) + xyPadHalf;
    CGFloat commentContentW = WDScreenW - commentContentX - xyPadding;
    CGFloat commentContentH = 0;
    
    CGSize contentSize = [XYCommon xy_getSizeWithStr:callItem.content font:xyCallDetailCommentContentFont maxSize:CGSizeMake(commentContentW, MAXFLOAT)];
    commentContentH = contentSize.height;

    self.contentLabelF = CGRectMake(commentContentX, commentContentY, commentContentW, commentContentH);
    
    CGFloat lineViewX = self.userNameLabelF.origin.x;
    CGFloat lineViewY = CGRectGetMaxY(self.contentLabelF) + xyPadding;
    CGFloat lineViewW = WDScreenW - lineViewX;
    CGFloat lineViewH = xy(0.5);
    
    self.lineViewF = CGRectMake(lineViewX, lineViewY, lineViewW, lineViewH);

    _xyCellH = CGRectGetMaxY(self.lineViewF) + xyPadHalf;

}

@end
































